<template>
	<view class="index">
		<!-- 头部 -->
		<view class="title">
			<view class="image_box">
				<image class="title_image" :src="doctorobj.img" mode="aspectFill"></image>
				<!-- <view>{{doctorobj.status=='normal'?'已出诊':'已休息'}}</view> -->
			</view>
			<view class="title_bos font13 font-ffffff">
				<view class="title_name">你好,<text>{{doctorobj.name}}</text>欢迎回来</view>
				<view>{{nowDate}} {{nowWeek}}</view>
				<view class="title_box">
					<view>
						今日图文人数
						<text>{{doctorobj.day_consultation_count}}</text>
					</view>
					<view>
						今日视频人数
						<text>{{doctorobj.day_consultation_viedo_count}}</text>
					</view>
				</view>
				<view class="title_box">
					<view>
						历史图文人数
						<text>{{doctorobj.history_consultation_count}}</text>
					</view>
					<view>
						历史视频人数
						<text>{{doctorobj.history_consultation_viedo_count}}</text>
					</view>
				</view>
			</view>

		</view>
		<!-- 医生工作站 -->
		<view class="doc_title">
			<view></view>
			<text class="font-323232 font14 font-b">医生工作站</text>
		</view>
		<!-- 内容 -->
		<view class="info_bos">
			<view v-for="(item,index) in infolist" :key="index" class="info_list" @click="Onjumpa(item)">
				<view class="info_box">
					<image :src="item.img" mode=""></image>
					<view v-if="item.numshow">{{item.num}}</view>
				</view>
				<view class="font-323232 font14">{{item.title}}</view>
			</view>
		</view>
		<ComTabBarDoc :selected="0"></ComTabBarDoc>
	</view>
</template>

<script>
	import ComTabBarDoc from '@/components/ComTabBarDoc.vue';
	export default {
		components: {
			ComTabBarDoc
		},
		data() {
			return {
				nowDate: '', //年月日
				nowWeek: '', //周几
				doctorobj: {}, //详情
				infolist: [{
						title: '图文问诊',
						img: require('@/static/doctor/info_e.png'),
						url: '/pagesA/doctor/textpage',
						num: '',
						numshow: true,
					},
					{
						title: '视频问诊',
						img: require('@/static/doctor/info_f.png'),
						url: '/pagesA/doctor/videopage',
						num: '',
						numshow: true,
					},
					{
						title: '我的开方',
						img: require('@/static/doctor/info_g.png'),
						url: '/pagesA/prescript/order2',
						num: '',
						numshow: false,
					},
					{
						title: '处方模板',
						img: require('@/static/doctor/info_h.png'),
						url: '/pagesA/prescript/list1',
						num: '',
						numshow: false,
					},
				],
			}
		},
		onShow: function() {
			wx.hideTabBar()
			//详情
			this.Ondoctor()
		},
		onLoad() {
			//获取时间
			this.Ontime()
		},
		methods: {
			//详情
			Ondoctor() {
				this.$Http({
					url: 'getUserInfo',
					data: {},
					type:'POST',
				}).then(res => {
					if (res.code == 1) {
						res.data.doctor_info.img = this.$store.state.http_img + res.data.doctor_info.img
						this.doctorobj = res.data.doctor_info
						this.infolist.forEach(item => {
							if (item.title == '图文问诊') {
								item.num = res.data.doctor_info.day_consultation_count_normal + ''
							}
							if (item.title == '视频问诊') {
								item.num = res.data.doctor_info.day_consultation_viedo_count_normal + ''
							}
						})
					}
				});
			},
			//获取时间
			Ontime() {
				let date = new Date()
				// 获取日期：年月日
				const year = date.getFullYear()
				const month = date.getMonth() + 1
				const day = date.getDate()
				this.nowDate = year + "年" + month + "月" + day + "日"
				// 获取星期几
				const weeks = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六");
				this.nowWeek = weeks[new Date().getDay()];
				console.log(this.nowDate, this.nowWeek)
			},
			//跳转页面
			Onjumpa(res) {
				let url = res.url
				uni.navigateTo({
					url: url,
				})
			},
		}
	}
</script>

<style>
	page{
		padding-bottom: constant(safe-area-inset-bottom);
		padding-bottom: env(safe-area-inset-bottom);
	}
	/* 头部 */
	.title {
		width: 750rpx;
		height: 340rpx;
		background-image: linear-gradient(#2f4678, #4785b8);
		padding: 0 40rpx;
		display: flex;
		align-items: center;
	}

	.image_box {
		width: 170rpx;
		height: 220rpx;
		position: relative;
		margin-right: 30rpx;
	}

	.title_image {
		width: 170rpx;
		height: 220rpx;
		border-radius: 10rpx;
	}

	.image_box view {
		position: absolute;
		background-color: #f39803;
		padding: 8rpx 10rpx;
		font-size: 20rpx;
		color: #ffffff;
		bottom: 10rpx;
		right: 10rpx;
		border-radius: 6rpx;
	}

	.title_bos {
		width: 470rpx;
		height: 220rpx;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
	}

	.title_name text {
		color: #da9e4e;
		margin: 0 20rpx;
	}

	.title_box {
		width: 470rpx;
		display: flex;
	}

	.title_box text {
		color: #da9e4e;
		margin-left: 10rpx;
	}

	.title_box view {
		width: 50%;
	}

	/* 医生工作站 */
	.doc_title {
		margin-left: 40rpx;
		margin-top: 30rpx;
		display: flex;
		align-items: center;
	}

	.doc_title view {
		width: 6rpx;
		height: 40rpx;
		background-color: #f19415;
		margin-right: 16rpx;
	}

	/* 内容 */
	.info_bos {
		display: flex;
		margin-top: 50rpx;
		padding-left: 40rpx;
	}

	.info_list {
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		margin-right: 60rpx;
	}

	.info_box {
		width: 60rpx;
		height: 60rpx;
		position: relative;
		margin-bottom: 14rpx;
	}

	.info_box image {
		width: 70rpx;
		height: 70rpx;
	}

	.info_box view {
		position: absolute;
		width: 30rpx;
		height: 30rpx;
		border-radius: 15rpx;
		top: -15rpx;
		right: -15rpx;
		background-color: #ff0000;
		color: #ffffff;
		font-size: 14rpx;
		display: flex;
		align-items: center;
		justify-content: center;

	}
</style>
